package lights;
/* 
 * Modified Version
 * Author : rendyjr
 * Date	  : Jun 10, 2011
 * 6.005 Elements of Software Construction
 * Rendy Bambang Junior
 * rendy.jr@gmail.com
 * 
 */

import java.awt.Color;

public class ColoredLight extends Light{
	private Color colors[] = {Color.black, Color.blue, Color.cyan, Color.darkGray,
			Color.gray, Color.green, Color.lightGray, Color.magenta, Color.orange,
			Color.pink, Color.red, Color.white, Color.yellow};
	
	private Color color;
	
	/**
	 * Creates a new colored light.
	 * @param color - color of this light.
	 */
	public ColoredLight(Color color) {
		// TODO
		this.color = color;
	}
	
	/**
	 * Returns the color of this light.
	 * @return color of this light.
	 */
	public Color getColor() {
		// TODO
		return color;
	}
	
	/**
	 * Changes the color of this light to be c.
	 */
	public void setColor(Color c) {
		// TODO
		color = c;
	}
	
	/**
	 * Randomly changes this light to be on or off and its color.
	 */
	@Override
	public void randomChange() {
		// TODO. 
		super.randomChange();
		setColor(colors[(int)Math.floor(Math.random()*12)]);
	}
	
}